<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>弹性盒子</title>
    <style>
        body{
            margin: 0;
            padding: 0;
            font-family: '微软雅黑';
            background-color: #f7f7f7;
        }
        ul{
            margin: 0;
            padding: 0;
            list-style: none;
        }
        .wrapper{
            width: 1024px;
            margin: 0 auto;
        }

        .wrapper > section{
            min-height: 300px;
            margin-bottom: 30px;
            box-shadow: 1px 1px 4px #DDD;
            background-color: #fff;
        }
        .wrapper > header{
            text-align: center;
            line-height: 1;
            padding: 20px;
            margin-bottom: 10px;
            font-size: 30px;
        }
        .wrapper section > header{
            line-height: 1;
            padding: 10px;
            font-size: 22px;
            color: #333;
            background-color: #EEE;
        }
        .wrapper .wrap-box{
            padding: 20px;
        }

        .wrapper .flex-img{
            width: 100%;
        }

        /* 两端对齐（传统） */
        section:nth-child(3) ul{
            overflow: hidden;
        }

        section:nth-child(3) li{
            width: 200px;
            height: 200px;
            text-align: center;
            line-height: 200px;
            font-size: 20px;
            float: left;
            background-color: pink;
            margin-right: 192px;
        }
        section:nth-child(3) li:last-child{
            margin-right: 0;
        }
        /* 两端对齐布局（伸缩布局） */
        section:nth-child(4) ul{
            display: flex;
            justify-content: space-between;
        }

        section:nth-child(4) li{
            width: 200px;
            height: 200px;
            text-align: center;
            /*margin-right: 10px;*/
            background-color: pink;
        }
    </style>
</head>
<body>
<div class="wrapper">
    <header>CSS3-伸缩布局介绍</header>
    <section>
        <header>新概念</header>
        <div class="wrap-box">
            <img class="flex-img" src="images/flex.png" alt=""/>
        </div>
    </section>
    <section>
        <header>两端对齐布局（传统）</header>
        <div class="wrap-box">
            <p>需要精确计算宽度及外边距，会很麻烦</p>
            <ul>
                <li>1</li>
                <li>2</li>
                <li>3</li>
            </ul>
        </div>
    </section>
    <section>
        <header>两端对齐布局（伸缩布局）</header>
        <div class="wrap-box">
            <p>自动精确控制对齐，无需计算</p>
            <ul>
                <li>1</li>
                <li>2</li>
                <li>3</li>
            </ul>
        </div>
    </section>
</div>
</body>
</html>